package com.ks.core.framework.cpsupload.demos.orderpayinvoice.paystrategy;

import com.ks.core.framework.cpsupload.demos.orderpayinvoice.constant.PaymentType;

import java.util.EnumMap;
import java.util.Map;

// 策略工厂
public class PaymentStrategyFactory {
    private static final Map<PaymentType, PaymentStrategy> strategies = new EnumMap<>(PaymentType.class);
    
    static {
        strategies.put(PaymentType.WECHAT, new WechatPaymentStrategy());
        strategies.put(PaymentType.ALIPAY, new AlipayPaymentStrategy());
        strategies.put(PaymentType.ALLINPAY, new AllinpayPaymentStrategy());
        strategies.put(PaymentType.VOUCHER, new VoucherPaymentStrategy());
    }
    
    public static PaymentStrategy getStrategy(PaymentType type) {
        return strategies.get(type);
    }
}